#include <X11/Xlib.h>

namespace uic
{

class UIC_Xlib : public GUIWindow
    {
    friend class CairoUI;
  public:
    UIC_Xlib();
    ~UIC_Xlib();

    cairo_t *get_cairo(CairoUI *ui);
    void resized(CairoUI *ui);
    void set_title(const char *str);

  protected:
    void process_input(CairoUI *ui, int fd);
    void fd_exception(CairoUI *ui, int fd);
    void perform_flush(CairoUI *ui);

    bool activate(CairoUI *ui);
    bool active();
    void move(int new_x, int new_y);

  private:
    void key_press(CairoUI *ui, XKeyEvent *ev);
    void set_wm_icon(CairoUI *ui);

    Display         *display;
    int              screen;
    Window           window;
#ifdef PIXMAP_BUFFER
    Drawable         pixmap;
    GC               window_gc;
#endif
    cairo_surface_t *surface;

    // for reading preferences
    int parse_color(const char *str, Color *color_return);
    };

}
